<template>
	<div id="tep1">
	<!-- 新闻详情 -->
		<div class="title">
			<h4>{{info.title}}</h4>
			<p>
				<span>{{info.add_time | datafmt('YYYY-MM-DD')}}</span>
				<span>{{info.click}}</span>
			</p>
		</div>
		<div v-html='info.content' id="content">
			内容
		</div>

		<!-- 评论 -->
		<comment :id='id'></comment>
	</div>
</template>

<script>
import common from '../../kits/common.js'
import comment from '../subcom/comment.vue'
	export default{
		components:{
			comment  //注册评论组件
		},
		data(){
			return{
				id:0,  //传入的ID值
				info:{}
			}
		},
		created(){
			// 获取url传入的ID参数值data中的ID属性
			this.id = this.$route.params.id;
			this.getinfo();
		},
		methods:{
			getinfo(){
				var url = common.apidomain + '/api/getnew/'+this.id;
				this.$http.get(url).then(function(res){
					var body = res.body;
					if(body.status != 0){
						alert('213');
						return;
					}
					this.info = body.message[0];

				})
			}
		}

	}
</script>

<style scoped>
	.title{
		text-align: left;
	}
	.title h4{
		color:#0094ff;
	}
	.title p{
		color:rgba(0,0,0,.5);
	}
	.title,#content{
		padding:5px;
	}
</style>